﻿@model KeyValuePair<string, string>
@{
    if (Model.Key.Equals("tianbaozhiliang", StringComparison.OrdinalIgnoreCase))
    {
        ViewBag.Title = "填报质量定制";
    }
    else if (Model.Key.Equals("suifangleixing", StringComparison.OrdinalIgnoreCase))
    {
        ViewBag.Title = "随访类型定制";
    }    
}
<style type="text/css">
    h2, textarea, p {
        margin-left:10px;
        margin-right:10px;
    }
    p input[type="submit"] {
        float:right;
    }
</style>
@if (!SiteUser.IsDoctorDepManager)
{
    <p class="error-title">对不起，只有科室主任才可以定制信息！</p>
}
else if (String.IsNullOrEmpty(Model.Key))
{
    <p class="error-title">未知的定制类型，该功能不可用！</p>   
}
else
{
    <script type="text/javascript">
        function validSubmit() {
            if ($.trim($('#Values').val()) == '') {
                $('#EditError').text('定制内容不能为空！').show();
                return false;
            }
            return true;
        };
    </script>
    if (ViewBag.Success != null)
    {
        if (ViewBag.Success == true)
        {
        <script type="text/javascript">
            $(function () {
                alert('保存成功！');
            });
        </script>
        }
        else
        {
        <script type="text/javascript">
            $(function () {
                $('#EditError').text('@(ViewBag.ErrorMessage != null ? ViewBag.ErrorMessage : "保存失败，请检查定制内容是否正确！")').show();
            });
        </script>
        }
    }
    if (Model.Key.Equals("tianbaozhiliang", StringComparison.OrdinalIgnoreCase))
    {
    <h2>定制填报质量</h2>
    }
    else if (Model.Key.Equals("suifangleixing", StringComparison.OrdinalIgnoreCase))
    {
    <h2>定制随访类型</h2>
    }
    using (Html.BeginForm())
    {
    @Html.Hidden("Key", Model.Key)
    <div class="editor-field">
        @Html.TextArea("Values", Model.Value, new { style = "width:98%;height:100px;" })
        <p>
            <span>说明：请以半角逗号（,）、半角分号（;）或换行分隔每项定制内容。</span>
            <input type="submit" value="确定" onclick="return validSubmit();" />
        </p>
        <p id="EditError" class="error-title"></p>
    </div>
    }
}